﻿
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;

namespace Core.Configuration.Api
{

    [Route("api/admin/[controller]/[action]")]
    [ApiController]
    public class AdminApi : ControllerBase
    {
        public AdminApi()
        {
        }

        protected int GetStoreId()
        {
            var store_id = GetHeaderInt("storeid");
            return store_id <= 0 ? 1 : store_id;
        }

        protected int GetHeaderInt(string name)
        {
            if (Request.Headers == null) return 0;

            var value = Request.Headers[name];
            if (string.IsNullOrEmpty(value)) return 0;
            return Convert.ToInt32(value);
        }
    }
}